#ifndef __APP_MQTT_H
#define __APP_MQTT_H

#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include "esp_system.h"
#include "nvs_flash.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "esp_log.h"
#include "mqtt_client.h"
#include "cJSON.h"
#include "App_Lora.h"
#include "App_wifi.h"



//OneNet的mqtt服务器地址+端口
#define CONFIG_BROKER_URL "mqtt://183.230.40.96" //或者mqtts://heclouds //mqtt服务器地址
#define CONFIG_BROKER_PORT 1883   //mqtt服务器端口

//连接ID（设备名称）
#define CONFIG_CONNECT_ID "ESP32_Master_01"

//用户名称（产品ID）
#define CONFIG_USER_NAME "9q87ky7u2C"

//password（软件生成）
#define CONFIG_PASSWORD "version=2018-10-31&res=products%2F9q87ky7u2C%2Fdevices%2FESP32_Master_01&et=2232480000&method=md5&sign=bgAxKnbgKy7NAUxpC7mkBQ%3D%3D"

//订阅主题
#define OneNET_Subscribe_Topic "$sys/" CONFIG_USER_NAME "/" CONFIG_CONNECT_ID "/thing/property/post/reply"
//发布主题
#define OneNET_Publish_Topic "$sys/" CONFIG_USER_NAME "/" CONFIG_CONNECT_ID "/thing/property/post"


extern esp_mqtt_client_handle_t client;    //mqtt客户端句柄
extern SemaphoreHandle_t mqtt_initialized_sem;  //mqtt连接成功信号量


void MQTT_Init(void);



#endif /* __APP_MQTT_H */
